<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center mine_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub mine_fd0_0'>
					<view class='flex flex-wrap align-center mine_fd0_0_c0'>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='mine_fd0_0_c1_c0'>{{$t('个人中心')}}</text>
					</view>
					<view @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/My/news/news`"
						class='flex flex-wrap align-center justify-end mine_fd0_0_c2'>
						<image class='mine_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"1598.png"'></image>
						<view v-if="news" class='mine_fd0_0_c2_c1'>
							{{news}}
						</view>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="flex benben-flex-layout flex-wrap align-center mine_flex_1">
				<image class='mine_fd1_0' mode="aspectFill"
					:src='UserInfo.avatar?UserInfo.avatar:STATIC_URL+"LOGO.png"'></image>
				<view class='flex flex-wrap align-center justify-between flex-sub mine_fd1_1'>
					<view class='flex flex-direction flex-wrap align-stretch mine_fd1_1_c0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/Mymine/Mydata/Mydata`">
						<text class='flex-sub mine_fd1_1_c0_c0'>{{group==1?UserInfo.real_name:UserInfo.nickname}}</text>
						<text class='mine_fd1_1_c0_c1'>{{group==1?UserInfo.account:UserInfo.name}}</text>
					</view>
					<text class='fu-iconfont2  mine_fd1_1_c1' @tap.stop="handleJumpDiy" data-type="navigateTo"
						:data-url="`/pages/Mymine/Mydata/Mydata`">&#xe7f2;</text>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout mine_flex_2" v-if="group==1">
				<view class='flex flex-wrap align-center justify-around mine_fd2_0'>
					<view class='flex flex-direction flex-wrap align-stretch justify-between mine_fd2_0_c0'
						@tap.stop="jumps" data-type="navigateTo" :data-url="``">
						<!-- <text class='mine_fd2_0_c0_c0'>{{group==1?UserInfo.kaoshi_num:UserInfo.course_num }}</text>
						<text class='mine_fd2_0_c0_c1'>{{group==1?'我的考试':'我的课程'}}</text> -->
						<text class='mine_fd2_0_c0_c0'>{{UserInfo.points}}</text>
						<text class='mine_fd2_0_c0_c1'>我的课程积分</text>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch justify-between mine_fd2_0_c0'
						@tap.stop="jump(num)">
						<text class='mine_fd2_0_c0_c0'>{{group==1?num:UserInfo.class_num}}</text>
						<text class='mine_fd2_0_c0_c1'>{{group==1?'我的错题':'我的班级'}}</text>
					</view>
				</view>
			</view>
			<view class="flex flex-wrap align-center justify-center benben-flex-layout fb_flex_3_ibhf" v-if="group==2">
				<view class='flex flex-wrap align-center fb_fd3_0_ibhf'>
					<view class='flex flex-wrap align-center fb_fd3_0_c0_ibhf'>
						<image class='imgs' mode="aspectFit" :src='STATIC_URL+"kc.png"'></image>
						<text class='fb_fd3_0_c0_c1_ibhf'>我的课程</text>
						<text class='fb_fd3_0_c0_c2_ibhf'>{{UserInfo.course_num}}</text>
					</view>

					<view class='flex self-center fb_fd3_0_c1_ibhf'></view>

					<view class='flex flex-wrap align-center fb_fd3_0_c0_ibhf'>
						<image class='imgs' mode="aspectFit" :src='STATIC_URL+"bj.png"'></image>
						<text class='fb_fd3_0_c0_c1_ibhf'>我的班级</text>
						<text class='fb_fd3_0_c0_c2_ibhf'>{{UserInfo.class_num}}</text>
					</view>
				</view>
			</view>
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout mine_flex_3">
				<view class='flex flex-wrap align-center justify-between mine_fd3_0' v-if="group==1">
					<view class='flex flex-direction flex-wrap align-center mine_fd3_0_c0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/Mymine/MyPortrayal/MyPortrayal`" v-if="group==1">
						<image class='mine_fd3_0_c0_c0' mode="aspectFill" :src='STATIC_URL+"1600.png"'></image>
						<text class='mine_fd3_0_c0_c1'>{{$t('我的画像')}}</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center mine_fd3_0_c0' @tap.stop="soundRecording()">
						<image class='mine_fd3_0_c0_c0' mode="aspectFill"
							:src='group==1?STATIC_URL+"1601.png":STATIC_URL+"16001.png"'></image>
						<text class='mine_fd3_0_c1_c1'>{{group==1?$t('AI教学助手'):'AI教师助手'}}</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center mine_fd3_0_c0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/Mymine/ranking/ranking`" v-if="group==1">
						<image class='mine_fd3_0_c0_c0' mode="aspectFill" :src='STATIC_URL+"1602.png"'></image>
						<text class='mine_fd3_0_c0_c1'>{{$t('排行榜')}}</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center mine_fd3_0_c0' v-if="group==2">
						<image class='mine_fd3_0_c0_c0' mode="aspectFill" :src='STATIC_URL+"sjtj.png"'></image>
						<text class='mine_fd3_0_c0_c1'>数据统计</text>
					</view>
					<view class='flex flex-direction flex-wrap align-center mine_fd3_0_c3' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/install/install`">
						<image class='mine_fd3_0_c0_c0' mode="aspectFill" :src='STATIC_URL+"1603.png"'></image>
						<text class='mine_fd3_0_c0_c1'>{{$t('系统设置')}}</text>
					</view>
				</view>
				 <view class="flex flex-direction align-stretch benben-flex-layout fb_flex_4_ibhf" v-else>
					<view class='flex flex-wrap align-center fb_fd4_0_ibhf'  @tap.stop="soundRecording()">
						<image class='fb_fd4_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"16001.png"'></image>
						<text class='fb_fd4_0_c1_ibhf'>AI教师助手</text>
						<text class='fu-iconfont2  fb_fd4_0_c2_ibhf'>&#xe7f2;</text>
					</view>
					<view class='flex flex-wrap align-center fb_fd4_0_ibhf'>
						<image class='fb_fd4_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"sjtj.png"'></image>
						<text class='fb_fd4_0_c1_ibhf'>数据统计</text>
						<text class='fu-iconfont2  fb_fd4_0_c2_ibhf'>&#xe7f2;</text>
					</view>
					<view class='flex flex-wrap align-center fb_fd4_0_ibhf' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/install/install`">
						<image class='fb_fd4_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"1603.png"'></image>
						<text class='fb_fd4_0_c1_ibhf'>系统设置</text>
						<text class='fu-iconfont2  fb_fd4_0_c2_ibhf'>&#xe7f2;</text>
	
					</view>
				</view>
			</view>
		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"num": '', //错题数量
				"UserInfo": {
					"id": "",
					"nickname": "",
					"baseclass_name": "",
					"basemajor_name": "",
					"avatar": "",
					"real_name": "",
					"gender": "",
					"mobile": "",
					"birthday": "",
					"baseclass_grade": "",
					"political_status_name": "",
					"account": "",
					"basedept_name": "",
					"degree_name": "",
					"degree": "",
				},
				news: 0,
				group: 1, //1学生 2教师
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.getck6f4cf3a2bf31Func()
			this.get_student_msg_num()
			this.group = uni.getStorageSync('USER_GROUP')
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			// soundRecording() {
			// 	if (appAuthorizeSetting.microphoneAuthorized == 'authorized') {
			// 		this.$urouter.navigateTo(`/pages/Mymine/aiSeart/aiSeart`)
			// 	} else if (appAuthorizeSetting.microphoneAuthorized == 'denied') {
			// 		this.$message.info('请在手机设置打开麦克风权限再进入AI教学助手')
			// 		return
			// 	} else {
			// 		this.startRecord()
			// 	}
			// },
			async get_student_msg_num() {
				let url = global.apiUrls.post68414cba9e017
				// if(uni.getStorageSync('USER_GROUP') == 2){
				// 	return
				// 	url=global.apiUrls.post68414ce1b5e21
				// }else{
				// 	url=global.apiUrls.post68414cba9e017
				// }
				let res = await this.$api.get(url, {});

				if (res.data.code != 1) {
					this.$message.info(res.data.msg);
					return
				}
				this.news = res.data.data.site_msg + res.data.data.system_num

				console.log('............', res);
			},
			jump(val) {
				if (uni.getStorageSync('USER_GROUP') == 2) {
					return
				}
				if (!val) {
					this.$message.info('暂无错题')
					return
				}
				// this.$urouter.navigateTo(`/pages/Mymine/aiSeart/aiSeart`);
				uni.navigateTo({
					url: "/pages/tabBar/wrongQuestion/wrongQuestion?type=2"
				})
			},
			soundRecording() {
				console.log(uni.getStorageSync('USER_GROUP'))
				let group=uni.getStorageSync('USER_GROUP')
				uni.navigateTo({
					url: '/pages/Mymine/aiSeart/aiSeart?group='+group
				})
				// this.$urouter.navigateTo(`/pages/Mymine/aiSeart/aiSeart`);
				// const appAuthorizeSetting = uni.getAppAuthorizeSetting();
				// if (appAuthorizeSetting.microphoneAuthorized == "authorized") {
				// 	this.$urouter.navigateTo(`/pages/Mymine/aiSeart/aiSeart`);
				// } else if (appAuthorizeSetting.microphoneAuthorized == "denied") {
				// 	this.$message.info("请在手机设置打开麦克风权限再进入AI教学助手");
				// } else {
				// 	const recorderManager = uni.getRecorderManager();
				// 	recorderManager.onStart(function(res) {
				// 		recorderManager.stop();
				// 		this.$urouter.navigateTo(`/pages/Mymine/aiSeart/aiSeart`);
				// 	});
				// 	recorderManager.start();
				// }
			},
			startRecord() {
				console.log('开始录音');
				recorderManager.start();
			},
			//APP接口-我的画像-个人信息
			async getck6f4cf3a2bf31Func() {
				//请求方法
				//数据验证
				let url = global.apiUrls.post66f4cf3a2bf31
				// if(uni.getStorageSync('USER_GROUP') == 2){
				// 	 url=global.apiUrls.post671a23b16d698
				// }
				let dataUserInfo = await this.$api.get(url, {

				});

				if (dataUserInfo.data.code != 1) {
					this.$message.info(dataUserInfo.data.msg);
					return
				}
				let infoUserInfo = dataUserInfo.data;
				this.UserInfo = infoUserInfo.data

				//错题数量
				const res1 = await this.$api.get(global.apiUrls.post67735544acf41, {});
				this.num = res1.data.data.count
			},
			jumps() {
				uni.navigateTo({
					url:'/pages/My/jf/jf'
				})
				return
				if (uni.getStorageSync('USER_GROUP') == 1) {
					uni.navigateTo({
						url: '/pages/exam/examList/examList'
					})
				} else {
					uni.navigateTo({
						url: '/pages/index/indSeaRes/indSeaRes'
					})
				}
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(image-path('1597.png')) no-repeat;
		background-size: 100% auto;
	}

	.mine_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
	}

	.mine_fd0_0_c2_c1 {
		width: 30rpx;
		height: 30rpx;
		border-radius: 20rpx;
		background-color: rgba(211, 42, 41, 1);
		position: absolute;
		top: -12rpx;
		right: -15rpx;
		color: #fff;
		font-size: 20rpx;
		line-height: 30rpx;
		text-align: center;
	}

	.mine_fd0_0_c2_c0 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.mine_fd0_0_c2 {
		width: 120rpx;
		position: relative;
	}

	.mine_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.mine_fd0_0_c0 {
		width: 120rpx;
	}

	.mine_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.mine_flex_1 {
		padding: 0rpx 24rpx 0rpx 24rpx;
		margin: 40rpx 0rpx 46rpx 0rpx;
	}

	.mine_fd1_1_c1 {
		font-size: 26rpx;
		color: rgba(51, 51, 51, 1);
	}

	.mine_fd1_1_c0_c1 {
		color: rgba(153, 153, 153, 1);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.mine_fd1_1_c0_c0 {
		margin: 0rpx 0rpx 16rpx 0rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		color: rgba(51, 51, 51, 1);
		font-size: 36rpx;
		font-weight: 500;
		line-height: 50rpx;
	}

	.mine_fd1_1_c0 {
		width: 400rpx;
	}

	.mine_fd1_1 {
		margin: 0rpx 0rpx 0rpx 0rpx;
	}

	.mine_fd1_0 {
		width: 128rpx;
		height: 128rpx;
		border-radius: 64rpx;
		margin: 0rpx 24rpx 0rpx 0rpx;
	}

	.mine_flex_2 {
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.mine_fd2_0_c0_c1 {
		color: rgba(102, 102, 102, 1);
		text-align: center;
	}

	.mine_fd2_0_c0_c0 {
		text-align: center;
		color: #333;
		font-size: 44rpx;
		font-weight: 600;
		line-height: 62rpx;
	}

	.mine_fd2_0_c0 {
		height: 100%;
		width: 200rpx;
	}

	.imgs {
		width: 56rpx;
		height: 56rpx;
	}

	.mine_fd2_0 {
		background: var(--benbenbgColor1);
		width: 100%;
		height: 175rpx;
		background-size: 100% auto;
		border-radius: 16rpx;
		padding: 32rpx;
	}

	.mine_flex_3 {
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.mine_fd3_0_c3 {
		margin: 0rpx 0rpx 32rpx 0rpx;
		width: 120rpx;
	}

	.mine_fd3_0_c1_c1 {
		font-size: 24rpx;
		font-weight: 500;
		color: #333333;
		margin: 16rpx 0rpx 0rpx 0rpx;
		max-width: 120rpx;
		line-height: 33rpx;
	}

	.mine_fd3_0_c0_c1 {
		font-size: 24rpx;
		font-weight: 500;
		color: #333333;
		margin: 16rpx 0rpx 0rpx 0rpx;
		max-width: 96rpx;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		line-height: 33rpx;
	}

	.mine_fd3_0_c0_c0 {
		width: 56rpx;
		height: 56rpx;
	}

	.mine_fd3_0_c0 {
		margin: 0rpx 30rpx 32rpx 0rpx;
		width: 120rpx;
	}

	.mine_fd3_0 {
		background: var(--benbenbgColor1);
		padding: 40rpx 45rpx 0rpx 45rpx;
		background-size: 100% auto;
		border-radius: 24rpx;
	}

	.mine_flex_4 {
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.mine_fd4_0 {
		width: 100%;
		height: 300rpx;
		border-radius: 16rpx;
	}

	.fb_flex_3_ibhf {
		padding: 0rpx 24rpx 0rpx 24rpx;

		.fb_fd3_0_c0_ibhf {
			width: 45%;
		}

		.fb_fd3_0_c0_c1_ibhf {
			margin: 0rpx 0rpx 0rpx 16rpx;
			color: #333333;
			font-size: 32rpx;
			font-weight: 400;
			line-height: 45rpx;
			text-align: left;
			font-style: normal;
		}
		 .fb_fd3_0_c0_c2_ibhf {
		            color: #333333;
		            font-size: 36rpx;
		            font-weight: 700;
		            line-height: 50rpx;
		            text-align: left;
		            font-style: normal;
		            margin: 0rpx 0rpx 0rpx 24rpx;
		        }

		.fb_fd3_0_ibhf {
			background: #ffffff;
			height: 114rpx;
			padding: 0rpx 20rpx 0rpx 20rpx;
			border-radius: 16rpx;
			position: relative;
			width: 100%;

			.fb_fd3_0_c1_ibhf {
				width: 1rpx;
				height: 30rpx;
				background: #85ce61;
				margin: 0rpx 20rpx 0rpx 20rpx;
				transform: scaleX(0.5);
			}
		}
	}
	.fb_flex_4_ibhf {
	    background: #ffffff;
		border-radius: 16rpx;
	    background-size: 100% auto;
		 padding: 0rpx 24rpx 0rpx 24rpx;
		.fb_fd4_0_ibhf {
		   
		    height: 114rpx;
			border-bottom: 1rpx solid rgba(242, 244, 247, 1);
		}
		.fb_fd4_0_c0_ibhf {
		    width: 50rpx;
		    height: 50rpx;
		    border-radius: 0rpx;
		}
		.fb_fd4_0_c1_ibhf {
		    color: #333333;
		    font-size: 34rpx;
		    font-weight: 400;
		    line-height: 48rpx;
		    text-align: left;
		    font-style: normal;
		    margin: 0rpx 0rpx 0rpx 24rpx;
		}
		
		.fb_fd4_0_c2_ibhf {
		    margin: 0rpx 0rpx 0rpx auto;
		}
		// .fb_fd4_0_c3_ibhf {
		//     width: 100%;
		//     height: 1rpx;
		//     background: rgba(242, 244, 247, 1);
		//     margin: 0rpx 0rpx 0rpx 0rpx;
		//     transform: scaleY(0.5);
		// }
	}
</style>
